cc.Class({
    extends: cc.Component,

    properties: {
        leftBtn:cc.Node,
        rightBtn:cc.Node,
        box:cc.Node,
        level:{
            default:[],
            type:cc.Node
        },
        icon:{
            default:[],
            type:cc.Node
        },
        typeText:cc.Label,
        text:{
            default:[],
            type:cc.String 
        },
        loading:cc.Node,
    },

    // use this for initialization
    onLoad: function () {

    },

    show:function() {
        this.node.active = true;
    },

    hide:function() {
        this.node.active = false;
    },

    turnLeft :function() {
        this.leftBtn.active = false;
        this.box.runAction(cc.sequence(cc.moveTo(0.7,cc.p(-375, 0)),cc.callFunc(function() {
            this.rightBtn.active = true;
        }, this))); 
    },

    turnRight:function(){
        this.rightBtn.active = false;
        this.box.runAction(cc.sequence(cc.moveTo(0.7,cc.p(-1125, 0)),cc.callFunc(function() {
            this.leftBtn.active = true;
        }, this))); 
    },

    selectLevel:function(e,num){
        for(i in this.level){
            if(i == num){
                this.curNum = num;
                this.typeText.string = this.text[i];
                this.icon[i].active = true;
                this.level[i].active = true;
                this.rightBtn.active = true;
            }else{
                this.icon[i].active = false;
                this.level[i].active = false;
            }
        }
    },

    startGame:function(){
        switch(this.curNum){
            case '0': cc.director.loadScene("da");break;
            case '1': cc.director.loadScene("tao");break;
            case '2': cc.director.loadScene("sha");break;
        }
    },

    // called every frame, uncomment this function to activate update callback
    // update: function (dt) {

    // },
});
